package vg_connector.tests;

import vg_connector.implementation.ServerAPIService;
import vg_connector.interfaces.IServerAPIService;
import vg_connector.interfaces.IServerListener;
import vg_connector.interfaces.actions.ParentMessage;

import java.util.UUID;

/**
 * @author Timur Zolotuhin (e-mail: tzolotuhin@gmail.com)
 */
public class Server {
    public static void main(String[] args) {
        UUID instanceId = new UUID(0, 0);

        IServerAPIService serverAPIService = new ServerAPIService();

        try {
            serverAPIService.connect(instanceId);
            serverAPIService.addServerListener(new IServerListener() {
                @Override
                public void connect() {
                    System.out.println("Connect");
                }

                @Override
                public void disconnect() {
                    System.out.println("Disconnect");
                }

                @Override
                public void receive(ParentMessage message) {
                    //System.out.println("Receive: " + message.toString());
                }
            });
        } catch (Throwable ex) {
            ex.printStackTrace();
        }

        while (true) {
            try {
                Thread.sleep(1000 * 10);
            } catch (Exception ex) {

            }
        }
    }
}
